import { message } from 'ant-design-vue';

export const formatData = (data = {}, name = '') => {
  if(!data.time) {
    message.error('缺少 time 字段');
    throw new Error(`缺少 time 字段`)
  }
  const o = {}
  for (const k in data) {
    if(k === 'time') continue
    o[`${name}${k}`] = data.time.map((item, index) => [item, data[k][index]])
  }
  return o
}